#ifndef _FENGINE_PRIMITIVE
#define _FENGINE_PRIMITIVE

#include <vector>
#include "CoreEngine.h"
#include "FEngineType.h"
#include "Node.h"
#include "ColorRGB.h"

namespace FEngine
{
	/**
	 * Abstract class used to create basic shapes.
	 */
	class Primitive : public Node
	{

		public:

			/**
			 * Constructor.
			 */
			Primitive();
			virtual ~Primitive();
			
			/**
			 * Set the color of all the line.
			 * @param _color Color of the line.
			 */
			void setColor(const ColorRGB& _color);

			/**
			 * Set the color of all the line.
			 * @param _red Red component of the color of the line.
			 * @param _green Green component of the color of the line.
			 * @param _blue Blue component of the color of the line.
			 */
			void setColor(unsigned char _red, unsigned char _green, unsigned char _blue);
			
			/**
			 * Return the color of all the line.
			 * @return Color of the line.
			 */
			ColorRGB getColor() const;

			virtual void update(double _elapsedTime);
			virtual void render(double _elapsedTime);
			
		protected:

			D3DPRIMITIVETYPE				mPrimitiveType;
			LPDIRECT3DVERTEXBUFFER9			mVertexBuffer;
			IDirect3DVertexDeclaration9*	mVertexDeclaration;
			LPDIRECT3DINDEXBUFFER9			mIndexBuffer;
			
			int								mNumberVertices;
			int								mNumberPrimitives;
			
			bool							mIsGenerated;
			ColorRGB						mColor;
			

			virtual void _createGeometry(const std::vector<Vector3>& _verticesVector, const std::vector<unsigned int>& _indexesVector, D3DPRIMITIVETYPE _primitiveType);
	};

} // namespace FEngine

#endif
